package com.serviceprovider.business.module.sp.transaction.services.impl;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.common.Page;
import com.serviceprovider.business.module.sp.transaction.model.Batch;
import com.serviceprovider.business.module.sp.transaction.model.TransactionDetail;
import com.serviceprovider.business.module.sp.transaction.model.TransactionUserAmount;
import com.serviceprovider.business.module.sp.transaction.services.dao.interfaces.ITransactionUserAmountDao;
import com.serviceprovider.business.module.sp.transaction.services.interfaces.ITransactionUserAmountService;
import com.serviceprovider.business.module.user.model.impl.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

//~--- JDK imports ------------------------------------------------------------

import java.util.List;
import java.util.Map;

@Repository("transactionUserAmountService")
public class TransactionUserAmountServiceImpl implements ITransactionUserAmountService {
    @Autowired
    ITransactionUserAmountDao transactionUserAmountDao;

    @Override
    public TransactionUserAmount insert(TransactionUserAmount transUserAmount) {
        return transactionUserAmountDao.insert(transUserAmount);
    }

    @Override
    public void delete(int id) {
        transactionUserAmountDao.delete(id);
    }

    @Override
    public void update(TransactionUserAmount transactionUserAmount) {
        transactionUserAmountDao.update(transactionUserAmount);
    }

    @Override
    public TransactionUserAmount getById(int id) {
        return transactionUserAmountDao.getById(id);
    }

    @Override
    public Page<TransactionUserAmount> find(int pageNumber, int pageSize, String sortColumn, String sortOrder) {
        return transactionUserAmountDao.find(pageNumber, pageSize, sortColumn, sortOrder);
    }

    @Override
    public List<User> findPayeesOfProvider(Integer providerId) {
        return transactionUserAmountDao.findPayeesOfProvider(providerId);
    }

    @Override
    public Map<Integer, Integer> calculateTotalAmount(List<Integer> transactionId) {
        return transactionUserAmountDao.calculateTotalAmount(transactionId);
    }

    @Override
    public List<TransactionUserAmount> findByTransactionDetail(Batch batch, TransactionDetail trans) {
        return transactionUserAmountDao.findByTransactionDetail(batch, trans);
    }

    @Override
    public void deleteByBatchId(Integer batchId) {
        transactionUserAmountDao.deleteByBatchId(batchId);
    }

    @Override
    public TransactionUserAmount findPayeeByIds(int transactionId, int payeeUserId) {
        return transactionUserAmountDao.findPayeeByIds(transactionId, payeeUserId);
    }

    @Override
    public void updateAll(TransactionDetail transactionDetail) {
        transactionUserAmountDao.updateAll(transactionDetail);
    }

    public void deleteAllByTransactionId(Integer transactionId) {
        transactionUserAmountDao.deleteAllByTransactionId(transactionId);
    }
}



